<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />

    <link rel="icon" type="image/png" href="/icon.png" />
    <link rel="preconnect" href="https://fonts.googleapis.com" />
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
    <link
      href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=IBM+Plex+Mono:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&display=swap"
      rel="stylesheet"
    />
    <link
      href="https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&display=swap"
      rel="stylesheet"
    />
    <script src="https://cdn.amplitude.com/libs/analytics-browser-2.11.1-min.js.gz"></script>
    <script>
      window.amplitude.init('ab2408031a38aa5cb85587a27ecfc69c', {
        autocapture: {
          fileDownloads: false,
          formInteractions: false,
        },
        fetchRemoteConfig: true,
        recording: false,
        optOut: true,
      })
    </script>

    <script>
      const importFile = async (path) => {
        // Normalize the path for cross-platform compatibility
        const normalizedPath = path.replace(/\\/g, '/')
        const fullPath = `${processCwd}/${normalizedPath}`.replace(/\\/g, '/')

        // Handle Windows drive letters properly
        let importPath = fullPath
        if (navigator.platform.includes('Win')) {
          // On Windows, ensure proper drive letter handling
          if (fullPath.match(/^[A-Za-z]:/)) {
            importPath = `/@fs/${fullPath}`
          } else {
            importPath = `/@fs/${fullPath}`
          }
        } else {
          importPath = `/@fs/${fullPath}`
        }

        try {
          return await import(/* @vite-ignore */ importPath)
        } catch (error) {
          console.error(`Failed to import ${path}:`, error)
          // Return empty module if tutorial.tsx doesn't exist
          if (path === 'tutorial/tutorial.tsx') {
            return { steps: [] }
          }
          throw error
        }
      }
    </script>

    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Motia Workbench</title>
  </head>
  <body class="dark">
    <div id="root"></div>
    <script type="module" src="/src/main.tsx"></script>
  </body>
</html>
